upgrade crates and refactor#21
Open
wjeffreys96 wants to merge 22 commits into
Open
Conversation
drogue was releasing slowly or sometimes not at all when CAN messages were sent to it. I discovered the motor mutex was not being released because there was no inner scope, so I added one. I also moved the acknowledge CAN messages for both parachute boards to after the deployment happens because drogue was acknowledging even when it didnt release. These changes seem to fix the bug.
the parachute boards were sending multiple acknowledgment messages. the sender would reset the acknowledgment atomic to false, but then immediately set it back to true. We also use a signal instead of a watch for the motor i_sense hoping to avoid it immediately returning read_until_pos due to stale values in the watch.
rather than call .unwrap() on things, I have gone through and tried to propagate errors and handle them instead. When unwrap or expect is the simplest option, I've replaced them with defmt's unwrap instead of the builtin as it should use less resources.
I was checking the wrong time for whether or not to send the heartbeat message. Changed to time_now and it fixed the error
high means shorepower is off, low means it's on
this is maybe not a "bug" but it is a safety concern. we should never be unlocking th rings when shorepower is on. this prevents that.
we don't need to recreate the ring pos receiver every time we run the motor. this is a minor optimization but anything to keep the motor running operation as lean as possible is a good thing in my opinion.
this may or may not be necessary but since running the motor will wait for this task, doing it more often seems smart
Fix two errors where rocket ready was assumed to be active high, but it's actually active low. This was being masked by another error where rocket ready was being asserted when shorepower was on.
0661d21 to
b94291e
Compare
The docs were not good before. Also they became heavily out of date over time. I've reduced their verbosity as much as I could, and moved as much of the explanations of things to comments and the tops of modules.
b94291e to
5e44b15
Compare
The beeps will now be on by default but can be turned off by flashing with DISABLE_BEEP=true
forgot to make buzz_mode mut, linter didnt care because it doesnt use cfgs so it never thought it was being changed. also suppress some lints that occur because of cfg directives. Tested and working as normal on sender board
We should ignore the 100us continuity check the stratologger does when powering off. Also, panicing when there's an error sending the can deploy message is not a good idea, for now just log the error and keep going.
b4e30c9 to
275cac8
Compare
Mostly just syntax errors, but I will need to figure out how to not panic inside the error handler when making the strings for the limits command
When the CAN bus is down, if the telemetrum fires it will hold on to the shore power pin mutex until it can send a can message. The main thread will wait until it can unlock this mutex before it does anything else so that it can update state. this means if the CAN bus can't send the deploy message, nothing else can happen.
678dcdf to
4b8feb5
Compare
7e2ef5f to
5d07f2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Upgrade all crates to current versions
a. embassy v0.4.0 -> v0.6.0
b. embassy-sync v0.7.2 -> v0.8.0
c. embassy-executor v0.9.1 -> v0.10.0
d. embassy-time v0.5.0 -> v0.5.1
e. defmt-rtt v1.0.0 -> v1.1.0
f. heapless v0.9.1 -> v0.9.2
g. embedded-io-async v0.6.1 -> v0.7.0
h. portable-atomic v1.11 -> v1.13
Create parachute and sender modules for board specific code to reduce the length of the bin files.
a. parachute: ring, motor, cli, cmd, can, and state.
b. sender: can, cli, cmd, and state.
Switch from noline to embedded-cli as noline is now seemingly unmaintained and uses v0.6.1 of embedded-io-async, whereas embassy uses v0.7.0.
Move away from globally mutable state, instead having main manage flow and pass context as needed.
Problems needing addressed:
The
poscommand works, but the--pollarg for it is nonfunctional.embedded-clidoes not have an async command handler, and therefore runs directly inside main. If we were to run the polling while we had access to the cli writer, it would block other processes. Currently the way to write back out info gathered from an async task would be to prefetch it every iteration of main and print it as needed in the command handler. However as the poll needs to keep printing until the user interrupts it, and the command handler is sync, prefetching is not a solution.The code to create the cli's is very much repeating itself. At the moment it is literally copied and pasted between the two modules with one change: the type of command that each cli takes in. I tried to make the type of command the cli constructor would take generic, but I couldn't figure out how to describe the generic type in a way that would satisfy the compiler. I also tried defining the command enum inside a cfg directive, but this was causing compilation errors in other parts of the code.